import { notFound, useRouter } from 'next/navigation'; import { useClipboard } from '@/hooks'; import clsx from 'clsx'; import { allGuides } from 'contentlayer/generated'; import { escapeHtml, uiUrl } from '@/config/site'; import { dateTemplate, distanceToNow, format } from '@/lib/date'; import CTABannerEmails from '@/components/CTABAnnerEmails'; import Icon from '@/components/Icon'; import TablerSponsorsBanner from '@/components/TablerSponsorsBanner'; import Mdx from '@/components/MDX'; interface GuidePageProps { params: { slug: string } } async function getGuideFromParams(params) { const slug = params.slug || ''; const guide = allGuides.find((guide) => guide.slugAsParams === slug); if (!guide) { null; } return guide; } export async function generateStaticParams(): Promise< GuidePageProps['params'][] > { return allGuides.map((guide) => ({ slug: guide.slugAsParams, })); } export default async function GuidePage({ params }: GuidePageProps) { const guide = await getGuideFromParams(params); if (!guide) { notFound(); } const url = `${uiUrl}${guide.slug}`; // const router = useRouter(), // currentPath = router.pathname, // url = `${uiUrl}${guide.slug}` // clipboard = useClipboard() return ( <>
{/* {meta.date && ( )} */}

{guide.title}

{guide.summary}
{guide.image && (
{guide.title}
)}
{guide.tags && (
{guide.tags.map((tag) => (
{tag}
))}
)}
); }